import { Button, Card, Layout } from "antd";
import { Route, Routes, useNavigate } from "react-router";
import { DataChart } from "./DataChart";
import { ItemList } from "./ItemList/ItemList";

export const SetView = () => {
  return (
    <Routes>
      <Route path="" element={<Content />}></Route>
      <Route path="/dataChart" element={<DataChart />}></Route>
      <Route path="/itemList" element={<ItemList />}></Route>
    </Routes>
  );
};

const Content = () => {
  const nav = useNavigate();
  const showDataChart = () => nav("dataChart")
  const showItemList = () => nav("itemList")
  return (
    <Layout className="setView">
      <Card className="content">
        <Button type="primary" size="large" onClick={showItemList}>
          操作内容
        </Button>
        <Button type="primary" size="large" onClick={showDataChart}>
          查看数据
        </Button>
      </Card>
    </Layout>
  );
};
